package com.etone.smartAudit.domain;

import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.annotation.*;
import com.etone.smartAudit.enums.DataBaseType;
import com.etone.smartAudit.enums.UpdateFrequency;
import com.etone.smartAudit.enums.UseState;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author: sovy
 * @date: 2020/8/27
 * @description: 元数据模型
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "d_iap_data_model")
public class IapDataModel implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "intId", type = IdType.AUTO)
    private Integer id;

    /**
     * 来源ID(对应平台系统ID)，对应d_iap_platform的id
     */
    @TableField(value = "intPlatformId")
    private Integer platformId;

    /**
     * 系统平台名称
     */
    @TableField(exist = false)
    private String platformName;

    /**
     * 宽表名称，中文表名
     */
    @TableField(value = "vcCnTableName")
    private String cnTableName;

    /**
     * 表名（数据字典）,英文表名
     */
    @TableField(value = "vcEnTableName")
    private String enTableName;

    /**
     * (Freq:frequency)更新频率
     */
    @TableField(value = "vcUpdateFreq", updateStrategy = FieldStrategy.IGNORED)
    private UpdateFrequency updateFreq;

    /**
     * 数据表更新日期
     */
    @TableField(value = "dtUpdateTime")
    private Date updateTime;

    /**
     * (Psv:preservation)保存周期
     */
    @TableField(value = "intPsvCycle", updateStrategy = FieldStrategy.IGNORED)
    private Integer psvCycle;

    /**
     * 状态
     */
    @TableField(value = "vcUseState", updateStrategy = FieldStrategy.IGNORED)
    private UseState useState;

    /**
     * 说明
     */
    @TableField(value = "vcDescription", updateStrategy = FieldStrategy.IGNORED)
    private String description;

    /**
     * 一级分类id
     */
    @TableField(value = "intLevel1Id")
    private Integer level1Id;


    /**
     * 一级分类
     */
    @TableField(value = "vcLevel1")
    private String level1;

    /**
     * 二级分类id
     */
    @TableField(value = "intLevel2Id")
    private Integer level2Id;

    /**
     * 二级分类
     */
    @TableField(value = "vcLevel2")
    private String level2;

    /**
     * 数据样例
     */
    @TableField(value = "vcDataExamples")
    private String dataExamples;

    /**
     * 数据库类型MYSQL,GREENPLUM,ORACLE,HADOOP
     */
    @TableField(value = "vcDataBaseType")
    private DataBaseType dataBaseType;

    /**
     * 数据字典
     */
    @TableField(exist = false)
    private List<IapDataMeta> iapDataMetas;

    /**
     * 服务器id
     */
    @TableField(value = "intServerId")
    private Integer serverId;

    /**
     * 服务器名称
     */
    @TableField(value = "vcServerName")
    private String serverName;

    /**
     * 服务器ip
     */
    @TableField(value = "vcServerIp")
    private String serverIp;

    /**
     * 项目id
     */
    @TableField(value = "intItemId")
    private Integer itemId;

    /**
     * 项目名称
     */
    @TableField(value = "vcItemName")
    private String itemName;

    /**
     * 数据库库名
     */
    @TableField(value = "vcDatabaseName")
    private String databaseName;

    /**
     * scheme
     */
    @TableField(value = "vcSchemaName")
    private String schemaName;

    /**
     * 敏感等级id
     */
    @TableField(value = "intSenLevelId")
    private Integer senLevelId;

    /**
     * 等级名称
     */
    @TableField(value = "vcSenLevel")
    private String senLevel;

    /**
     * 数据平台id
     */
    @TableField(value = "intDataPssAId")
    private Integer dataPssAId;

    /**
     * 数据平台名称
     */
    @TableField(value = "vcDataPssA")
    private String dataPssA;

    /**
     * 数据维护标签id集合
     */
    @TableField(value = "vcDataAssertIds")
    private String dataAssertIds;

    /**
     * 数据维护标签名称
     */
    @TableField(value = "vcDataAssertNames")
    private String dataAssertNames;

    /**
     * 质量维度标签id集合
     */
    @TableField(value = "vcDataMassIds")
    private String dataMassIds;

    /**
     * 质量维度标签名称
     */
    @TableField(value = "vcDataMassNames")
    private String dataMassNames;

    /**
     * 使用方维度标签id集合
     */
    @TableField(value = "vcDimensionIds")
    private String dimensionIds;

    /**
     * 使用方维度标签名称
     */
    @TableField(value = "vcDimensionNames")
    private String dimensionNames;

    /**
     * 自动化维度标签id集合
     */
    @TableField(value = "vcAutoTagIds")
    private String autoTagIds;

    /**
     * 自动化维度标签名称
     */
    @TableField(value = "vcAutoTagNames")
    private String autoTagNames;

    /**
     * 数据时效开始时间
     */
    @TableField(value = "dtStartDateTime")
    private Date startDateTime;

    /**
     * 数据时效结束时间
     */
    @TableField(value = "dtEndDateTime")
    private Date endDateTime;

}